#include "NResource.h"
#include "NUtility.h"

using namespace Engine;

RTTI_DEFINITIONS(NResource)

NResource::NResource()
	:mInstanceName(""),
	 mFilePath(""),
	 mFileName(""),
	 mIsInitialized(false),
	 mRefCount(0)
{
}

NResource::NResource(const std::string& instanceName, const std::string& filePath)
	:mInstanceName(instanceName),
	 mFilePath(filePath),
	 mIsInitialized(false),
	 mRefCount(0)
{
	if(filePath.length())
	{
		std::vector<std::string> elems = Engine::split(std::string(filePath), '\\');
		if(elems.size())
		{
			mFileName = elems[elems.size()-1];
		}
	}
}

NResource::~NResource(void)
{
}

std::string NResource::GetFileName() const
{
	return mFileName;
}


std::string NResource::GetInstanceName() const
{
	return mInstanceName;
}

std::string NResource::GetFilePath() const
{
	return mFilePath;
}

unsigned long NResource::GetRefCount() const
{
	return mRefCount;
}

void NResource::IncreaseRefCount()
{
	mRefCount++;
}
	
void NResource::DecreaseRefCount()
{
	mRefCount--;
}